<!DOCTYPE html>
<html ng-app="myApp">
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script src="script-tags-for-development.js"></script>
<script src="USGSOverlay.js"></script>
<script>
  var app = angular.module('myApp', ['ngMap']);
  app.controller('OverlayHideshowCtrl', function(NgMap) {
    var vm = this;
    vm.overlay;
    NgMap.getMap().then(function(map){
      var swBound = new google.maps.LatLng(62.281819, -150.287132);
      var neBound = new google.maps.LatLng(62.400471, -150.005608);
      var bounds = new google.maps.LatLngBounds(swBound, neBound);
      var srcImage = 'https://developers.google.com/maps/documentation/javascript/';
      srcImage += 'examples/full/images/talkeetna.png';
      vm.overlay = new USGSOverlay(bounds, srcImage, map);
    });
    vm.toggleVisibility = function() {
      vm.overlay.toggle();
    }
    vm.toggleDOMAttachment = function() {
      vm.overlay.toggleDOM();
    };
  });
</script>
</head>

<body>
  <style>
    div[ng-controller] {
      position: relative;
    }
    #panel {
      position: absolute;
      top: 5px;
      left: 50%;
      margin-left: -90px;
      z-index: 5;
      background-color: #fff;
      padding: 5px;
      border: 1px solid #999;
    }
  </style>
  <div ng-controller="OverlayHideshowCtrl as vm">
    <div id="panel">
      <input ng-click="vm.toggleVisibility()" type=button value="Toggle Visibility">
      <input ng-click="vm.toggleDOMAttachment()" type=button value="Toggle DOM Attachment">
    </div>
    <ng-map zoom="11" center="62.323907, -150.109291" map-type-id="SATELLITE">
    </ng-map>
  </div>

</body>
</html>
